<?php
class Album extends AppModel {
	var $name = 'Album';
    var $validate = array(
        'image_id' => array(
            'rule'       => 'numeric',
            'allowEmpty' => true,
            'on'         => 'update',
            'message'    => 'Cover id must be numeric.'
        ),
        'name' => array(
            'minlength' => array(
                'rule'    => array('minLength', 1),
                'message' => 'You must enter an album name.'
            ),
            'maxlength' => array(
                'rule'    => array('maxLength', '100'),
                'message' => 'Album name must be no larger than 100 characters long.'
            )
        )
    );
	var $hasMany = array(
        'Image' => array(
            'className'  => 'Image',
            'foreignKey' => 'album_id',
            'fields'     => array('id','filename','title','description'),
            'order'      => 'Image.id ASC',
            'dependent'  => true
        )
    );
} // Album

?>